package com.atguigu.aspects;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

/**
 * projectName: com.atguigu.aspects
 *
 * @author: 赵伟风
 * description:
 */
@Aspect
@Component
public class LogAspect {

    @Before("com.atguigu.points.MyPointCut.logPC()")
    public void before(JoinPoint joinPoint){
        String simpleName = joinPoint.getTarget().getClass().getSimpleName();
        String name = joinPoint.getSignature().getName();
        System.out.println(simpleName+name+"进来了！！！");
    }

    @After("com.atguigu.points.MyPointCut.logPC()")
    public void after(JoinPoint joinPoint){
        String simpleName = joinPoint.getTarget().getClass().getSimpleName();
        String name = joinPoint.getSignature().getName();
        System.out.println(simpleName+name+"出去了！！！");
    }
}
